package me.raih.service.impl;

import me.raih.mapper.AdminMapper;
import me.raih.pojo.po.Admin;
import me.raih.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Objects;

/**
 * @Author Raih
 * @Time 2020/11/23  10:17
 */
@Service
@Transactional
public class AdminServiceImpl implements AdminService {

    @Autowired
    AdminMapper adminMapper;

    @Override
    public Admin login(String username, String password) {

        Admin admin = adminMapper.findAdminByUsernameAndPassword(username,password);

        if(Objects.nonNull(admin)){
            return admin;
        }

        return null;

    }
}
